//
//  ViewController.m
//  CAShapeLayer
//
//  Created by TengFeiLi on 15/7/13.
//  Copyright (c) 2015年 TengFeiLi. All rights reserved.
//

#import "ViewController.h"
#import "ProgressView.h"
#import "CircleView.h"
#import "CustomView.h"
#import "POP.h"
@interface ViewController ()

@property (nonatomic,strong) CircleView * custom;
@property (nonatomic,strong) CustomView * customView;

@property (nonatomic) CGPoint startPoint;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.custom = [[CircleView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    self.custom.center = CGPointMake(self.view.center.x, 180);
    [self.view addSubview:_custom];
    [_custom progress:CGPointZero];
    
    self.customView = [[CustomView alloc]initWithFrame:CGRectMake(0, 0, 100, 50)];
    [self.customView setTitle:@"上传" forState:UIControlStateNormal];
    [self.customView addTarget:self action:@selector(upload:) forControlEvents:UIControlEventTouchUpInside];
    self.customView.center = self.view.center;
    [self.view addSubview:self.customView];
}

-(void)upload:(UIButton *)button{
    [self.customView loading];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.custom reset];
    [self.customView reset];
}


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch * touch = [touches anyObject];
    CGPoint touchPos = [touch locationInView:self.view];
    NSLog(@"%@",NSStringFromCGPoint(touchPos));
    
   
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch * touch = [touches anyObject];
    CGPoint touchPos = [touch locationInView:self.view];
    NSLog(@"%@",NSStringFromCGPoint(touchPos));
    
    //    [self.custom progress:CGPointZero];
    
    [self.custom startAnimate];

}
@end
